package com.njlime.cms.sdk.letv;

/**
 * 乐视直播工具类
 * Created by Dean on 2017-10-13.
 */
public class LetvUtil {

    private static LetvApiClient letvApiClient;
    /**
     * 初始化
     * @param userId
     * @param secret
     * @return
     * @throws Exception
     */
    public static LetvApiClient initClient(String userId, String secret) throws Exception{
        if(letvApiClient != null && userId.equals(letvApiClient.getUserid()) && secret.equals(letvApiClient.getSecret())){
            return letvApiClient;
        }
        letvApiClient = LetvApiClient.getInstance();
        letvApiClient.setApiUrl("http://api.open.letvcloud.com/live/execute");
        letvApiClient.setHttpPort(80);
        letvApiClient.setUserid(userId); //用户id
        letvApiClient.setSecret(secret); //秘钥
        letvApiClient.initialize();
        return letvApiClient;
    }
}
